<?php
/* @var $this PropertiesController */
/* @var $model Properties */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'properties-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'prop_name'); ?>
		<?php echo $form->textField($model,'prop_name',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'prop_name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'prop_type'); ?>
		<?php
			$types = StaticLookup::model()->loadLookup('PropertyType');
			echo $form->dropDownList($model, 'prop_type', CHtml::listData($types, 'default_val', 'lu_val')); 
		?>
		<?php echo $form->error($model,'prop_type'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'prop_category'); ?>
		<?php
			$categories = CategoryMaster::model()->loadLookup();
			echo $form->dropDownList($model, 'prop_category', CHtml::listData($categories, 'category_id', 'category_name')); 
		?>
		<?php echo $form->error($model,'prop_category'); ?>
	</div>

	<div class="row">	
		<?php echo $form->hiddenField($model,'client_id',array('size'=>10,'maxlength'=>10, 'value'=>Yii::app()->user->getState('client_id'))); ?>
	</div>

	<div class="clear-fix"></div>
	
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
		
<script>
		$(document).ready(function(){
			$('#Properties_prop_name').change(function(){
				var propname = $('#Properties_prop_name').val();
				propname = propname.replace(/ /g, '');
				$('#Properties_prop_name').val(propname);
			});
		});
</script>
